- page_title    @user.name
- header_title  @user.name, user_path(@user)

= content_for :meta_tags do
  = auto_discovery_link_tag(:atom, user_url(@user, format: :atom), title: "#{@user.name} activity")

= render 'shared/show_aside'

.row
  %section.col-md-7
    .header-with-avatar
      = link_to avatar_icon(@user.email, 400), target: '_blank' do
        = image_tag avatar_icon(@user.email, 90), class: "avatar avatar-tile s90", alt: ''
      %h3
        = @user.name
        - if @user == current_user
          .pull-right.hidden-xs
            = link_to profile_path, class: 'btn btn-sm' do
              = icon('user')
              Profile settings
        - elsif current_user
          .report_abuse.pull-right
            - if @user.abuse_report
              %span#report_abuse_btn.light.btn.btn-sm.btn-close{title: 'Already reported for abuse', data: {toggle: 'tooltip', placement: 'right', container: 'body'}}
                = icon('exclamation-circle')
            - else
              %a.light.btn.btn-sm{href: new_abuse_report_path(user_id: @user.id), title: 'Report abuse', data: {toggle: 'tooltip', placement: 'right', container: 'body'}}
                = icon('exclamation-circle')

      .username
        @#{@user.username}
      .description
        - if @user.bio.present?
          = @user.bio

    .clearfix

    - if @groups.any?
      .prepend-top-20
        %h4 Groups
        = render 'groups', groups: @groups
        %hr

    .hidden-xs
      .user-calendar
        %h4.center.light
          %i.fa.fa-spinner.fa-spin
      .user-calendar-activities
      %hr
    %h4
      User Activity

      - if current_user
        %span.rss-icon.pull-right
          = link_to user_path(@user, :atom, { private_token: current_user.private_token }) do
            %strong
              %i.fa.fa-rss

    .content_list
    = spinner
  %aside.col-md-5
    = render 'profile', user: @user
    = render 'projects', projects: @projects, contributed_projects: @contributed_projects

:coffeescript
  $(".user-calendar").load("#{user_calendar_path}")
